import {createRouter, createWebHashHistory} from "vue-router";

import Home from "../components/Home.vue";
import List from "../components/List.vue";
import Add from "../components/Add.vue";
import Update from "../components/Update.vue";

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            components: {
                default: Home,
                HomeView: Home
            }
        }, {
            path: '/list',
            components: {
                listView: List
            }
        }, {
            path: '/showAll',
            /*重定向*/
            redirect: '/list',
        }, {
            path: '/add',
            components: {
                addView: Add
            }
        }, {
            path: '/update',
            components: {
                updateView: Update
            }
        }
    ]
    /* routes: [
         {
             path: '/',
             component: Home,
             default: Home,

         }, {
             path: '/list',
             component: List
         }, {
             path: '/add',
             component: Add
         },
         {
             path: '/update',
             component: Update
         }
     ]*/
})
export default router;